
#include "uart.h"
#include "string.h"
#include "task.h"
char g_Char = 'A';
const char g_Char2 = 'B';
int g_A[3] = {0, 0};
char g_B[9];

static char stack_a[1024] __attribute__ ((aligned (4)));;
static char stack_b[1024] __attribute__ ((aligned (4)));;


void delay(volatile int d)
{
	while(d--);
}


void task_a(void *param)
{
    char c = (char)param;
    while(1)
    {
        putchar(c);
    }
}



int mymain()
{
	char c;
	void (*funcptr)(const char *s, unsigned int val);

	static int s_C[16] = {0, 0};
	
	funcptr = put_s_hex;
	
	//uart_init();
	
	delay(1);
	
	putchar('1');
	putchar('0');
	putchar('0');
	putchar('a');
	putchar('s');
	putchar('k');
	putchar('\n');
	putchar('\r');
	
	funcptr("test for text relocate ", 123);
	
	put_s_hex("g_Char's addr  = ", (int)&g_Char);
	put_s_hex("g_Char2's addr = ", (int)&g_Char2);
	put_s_hex("g_A[0]'s val = ", g_A[0]);
	put_s_hex("g_B[0]'s val = ", g_B[0]);
	put_s_hex("s_C[0]'s val = ", s_C[0]);
	
	putchar(g_Char);
	putchar(g_Char2);
	
    creat_task(task_a,stack_a,(void*)'a',1024);
    putchar('a');
    creat_task(task_a,stack_b,(void*)'b',1024);
    start_task();
	
	return 0;
}
